#include<ctime>
#include<string>
#include<sstream>
#include<iostream>
using namespace std;

int  logtimeToUnix(const std::string& logtime){
  struct tm tm;
  time_t t;
  if(strptime(logtime.c_str(),"%d/%b/%Y:%H:%M:%S %Z",&tm) ==NULL)
    return -1;
  t= mktime(&tm);
  if(t == -1)
    return -1;
   
     return t;
 
}

int main(int argc, char **argv){

  std::string mytime;
  std:: cin>>mytime;
  std:: cout<< logtimeToUnix(mytime); 
  return 0;
}



